@extends('layouts.header')
@section('title','对接系统管理')
@section('content')
<div class="page-container">
    <div>
        <b class="btn btn-primary radius" id="sync">获取最新</b>
        <a class="btn btn-primary radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </div>
    <div class="mt-10">
        <table class="table table-border table-bordered table-hover table-bg table-responsive" id="datatable">
            <thead>
                <tr class="text-c">
                    <th>工器具类型</th>
                    <th>工器具主键</th>
                    <th>项目名称</th>
                    <th>项目主键</th>
                    <th>试验数据标题</th>
                    <th>同步时间</th>
                </tr>
            </thead>
            <tbody>
                @foreach($data as $item)
                    <tr class="text-c">
                        <td>{{$item->tool_name}}</td>
                        <td>{{$item->tool_id}}</td>
                        <td>{{$item->item_name}}</td>
                        <td>{{$item->item_id}}</td>
                        <td>
                            @if($item->data_keys)
                                @foreach(json_decode($item->data_keys,true) as $k=>$val)
                                    {{$k}}：{{$val}} <br>
                                @endforeach
                            @endif
                        </td>
                        <td>{{$item->ctime}}</td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('#datatable').DataTable();
    })
    $('#sync').on('click',function(){
        ajax('post','',{third_id:"{{request('third_id')}}"},function (res) {
            if(res == 1){
                location.reload();
            }
        });
    })
</script>
@endsection